package com.iscas.green.extralindextest.controller;

import com.iscas.green.extralindextest.service.ServiceApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 服务API控制器
 */
@RestController
@RequestMapping("/api/service")
public class ServiceApiController {

    private static final Logger log = LoggerFactory.getLogger(ServiceApiController.class);
    
    @Autowired
    private ServiceApiService serviceApiService;
    
    /**
     * 获取服务列表测试接口
     *
     * @param applicationId 应用ID，默认为1864944595792809985
     * @param namespace 命名空间，默认为default
     * @return 服务列表
     */
    @GetMapping("/list")
    public ResponseEntity<Object> getServiceList(
            @RequestParam(value = "applicationId", defaultValue = "1864944595792809985") String applicationId,
            @RequestParam(value = "namespace", defaultValue = "default") String namespace) {
        
        log.info("接收到获取服务列表请求, applicationId={}, namespace={}", applicationId, namespace);
        Object serviceList = serviceApiService.getServiceList(applicationId, namespace);
        
        return ResponseEntity.ok(serviceList);
    }
} 